-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor unit conversion messaging #3192
Conversation
4cfaeed
to
9293060
Compare
55c36a8
to
18e1562
Compare
405a11d
to
cee44db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't grok most of the stuff. Just a general review. Thanks.
jdaviz/app.py
Outdated
@@ -86,7 +86,16 @@ def equivalent_units(self, data, cid, units): | |||
'erg / (s sr cm2)', 'erg / (Hz s sr cm2)', | |||
'erg / (Angstrom s sr cm2)', | |||
'ph / (Angstrom s sr cm2)', 'ph / (Hz s sr cm2)' | |||
]) | |||
] | |||
+ [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the +
operators to chain multiple static lists here? This introduces unnecessary list math, no?
jdaviz/configs/default/plugins/model_fitting/tests/test_fitting.py
Outdated
Show resolved
Hide resolved
jdaviz/configs/default/plugins/model_fitting/tests/test_plugin.py
Outdated
Show resolved
Hide resolved
# If unit is flux per pix2, the type will be 'unknown' rather | ||
# than surface brightness, so have to multiply the pix2 part out | ||
# and check if the numerator is a spectral flux density | ||
if check_if_unit_is_per_solid_angle(unit, return_unit=True) == u.pix*u.pix: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move PIX2
higher up and re-use it throughout the package instead of u.pix*u.pix
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this after all these PRs are merged to avoid conflicts
jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py
Outdated
Show resolved
Hide resolved
d54cef4
to
9d04c43
Compare
@@ -89,6 +89,12 @@ def slice_values(self): | |||
take_inds = [2, 1, 0] | |||
take_inds.remove(self.slice_index) | |||
converted_axis = np.array([]) | |||
|
|||
# Retrieve display units |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just confirming, this was moved because the slice display units don't depend on layer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I moved this above the for-loop since it isn't needed to be called repeatedly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! left a few comments. This is a great improvement that makes it a lot clearer when unit changing messages are sent.
Could you explain briefly what the changes to slice are doing?
jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py
Outdated
Show resolved
Hide resolved
Sure! Changes to slice do the following:
|
235fe11
to
23fcaa6
Compare
re lag - there actually isn't more lag (as far as I can tell), but rather the attribute display limits are being updated before the spectral y units, and since the y units are what is the most visible immediate change, it feels like more lag. I'm working to try to optimize setting the display limits, since deferring changing those until last would require additional muddy logic. |
I was actually able to get the y-unit to be updated first and optimize attribute_display_unit - hopefully tests still pass 🤞. Let me know if you still see any noticeable difference in responsiveness between this and main. |
This reverts commit aa0d384.
* apply handle_spectral_y_unit before attribute_display_unit * optimize handle_attribute_display_unit by caching image layers
fd6562b
to
d467ccb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this again, the issues I commented yesterday are resolved, looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through unit_conversion.py
one more time and generally retested along with the comments from yesterday. Everything looks good to me, nice work!
Description
This pull request refactors and simplifies the messaging within unit conversion.
This currently is branched off of #3156, so should be moved onto main after that is merged.TODO
test_spectrum_viewer_axis_labels
from convert flux cubes to per-square-pixel surface brightness cubes #3156PIX2
vsu.pix * u.pix
from convert flux cubes to per-square-pixel surface brightness cubes #3156 - defer for follow-up by @cshanahan1Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.